home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
PC
/
MISCBAS
/
EDTEXT.ASC
< prev
next >
Wrap
Text File
|
1987-01-11
|
6KB
|
215 lines
10 REM **** TEXT EDITOR
70 GOTO 300
99 REM *** WRITE SECTION
100 CLEAR 8000
110 DIM A$(100)
111 INPUT"SET TAB AT NUMBER ";T
112 T=T-1
120 PRINT "READY":WAIT 0, 1, 1
130 PRINT:PRINT:PRINT:PRINT
140 FOR I=1 TO 1000
150 K=0
160 WAIT 0,1,1
170 A=INP(1):A=A AND 127
171 IF A=92 THEN 202
180 IF A=13 THEN 280
190 IF A=95 THEN 260
200 IF A=64 THEN A$(I)="":PRINT:GOTO 150
201 GOTO 210
202 B$="": IF K>=T THEN PRINT"":GOTO 160
203 FOR TAB =1 TO T-K:B$=B$+" ":NEXT TAB
204 PRINTB$;
205 K=K+T-1
207 GOTO 220
210 B$=CHR$(A):PRINT B$;
220 A$(I)=A$(I) + B$:K=K+1
230 IF A$(I)="END"THEN K2=I:GOTO 1500
240 IF LEN(A$(I))>69 THEN 280
250 GOTO 160
260 GOSUB 1000
270 GOTO 160
280 PRINT:NEXT I
299 REM *** PROGRAM CONTROL SECTION
300 INPUT "FUNCTION";F$
310 IF LEFT$(F$,2)="WR" THEN 100
320 IF LEFT$(F$,2)="PR" THEN 1500
330 IF LEFT$(F$,2)="ED" THEN 2000
340 IF LEFT$(F$,2)="EN" THEN END
400 PRINT "FUNCTIONS ARE:"
410 PRINT "WRITE","PRINT","EDIT","END"
500 GOTO 300
999 REM *** LAST CHARACTER EDIT SECTION
1000 C$=A$(I)
1005 IF K=0 THEN PRINT CHR$(7):RETURN
1010 IF K=1 THEN A$(I)="":PRINT CHR$(7):K=0:RETURN
1020 K=K-1:A$(I)=LEFT$(C$,K)
1030 PRINT:PRINT A$(I)
1040 RETURN
1499 REM *** PRINT SECTION
1500 PRINT:PRINT:PRINT:PRINT
1510 FOR I=1 TO 1000
1520 IF A$(I)="END" THEN 1590
1530 PRINT A$(I)
1540 NEXT I
1560 FOR T=1 TO 5000: NEXT T
1590 PRINT:PRINT:PRINT:PRINT:GOTO 300
2000 GOTO 2050
2001 REM *** EDIT LIST SECTION
2002 PRINT:PRINTTAB(5):FOR I=1 TO 6:PRINT"1234567890";:NEXT
2003 PRINT
2004 FOR I=1 TO 1000
2010 IF A$(I)="END" THEN 2050
2020 PRINT I;TAB(5);A$(I)
2030 NEXT I:PRINT:PRINT
2049 REM *** EDIT CONTROL SECTION
2050 INPUT"TYPE OF EDIT ";TE$
2060 E$=LEFT$(TE$,2)
2070 IF E$<>"CH"AND E$<>"IN"AND E$<>"DE"AND E$<>"LI"ANDE$<>"SE"THEN 2090
2080 GOTO 2120
2090 PRINT"TYPES OF EDITING ARE:"
2100 PRINT "CHANGE","INSERT","DELETE"
2105 PRINT "SEARCH","LIST"
2110 GOTO 2050
2120 IF E$="DE" THEN 5000
2125 IF E$="SE" THEN 5600
2130 IF E$="IN" THEN 4000
2134 IF E$="LI" THEN 2002
2139 REM *** EDIT CHANGE SECTION
2140 INPUT "WHICH LINE ";LN
2150 PRINT A$(LN)
2160 INPUT "CORRECT LINE ";CL$
2170 IF LEFT$(CL$,1)<>"Y" THEN 2140
2180 GOTO 3000
3000 INPUT "WHICH CHARACTER ";C
3010 PRINTMID$(A$(LN),C,1)
3020 INPUT "CORRECT CHARACTER ";CC$
3030 IF LEFT$(CC$,1)<>"Y" THEN 3000
3040 INPUT "CHANGE HOW MANY ";N
3050 IF N<0 OR (N+C)>LEN(A$(LN)) THEN 3040
3060 T1$=LEFT$(A$(LN),(C-1))
3070 T=LEN(A$(LN))-(C-1)-N
3080 T2$=RIGHT$(A$(LN),T)
3090 T$="":PRINT T1$;
3100 FOR I2=1 TO N
3110 WAIT 0,1,1
3120 Q=INP(1)
3130 Q=Q AND 127
3140 T$=T$+CHR$(Q):PRINT CHR$(Q);
3150 NEXT I2
3160 PRINT T2$
3170 A$(LN)=T1$+T$+T2$
3180 GOTO 300
3999 REM *** EDIT INSERT SECTION
4000 INPUT "LETTER OR LINE ";LL$
4010 IF LEFT$(LL$,2)="LE" THEN 4050
4020 IF LEFT$(LL$,2)="LI" THEN 4400
4030 GOTO 4000
4049 REM *** LETTER INSERT SECTION
4050 INPUT "WHICH LINE ";LN
4060 PRINT A$(LN):INPUT "CORRECT LINE ";CL$
4070 IF LEFT$(CL$,1)<>"Y" THEN 4050
4100 INPUT "AFTER WHICH CHARACTER ";LE
4110 IF LE>LEN(A$(LN)) THEN 4100
4111 IF LE=0 THEN PRINT"INSERT STARTS AT FIRST POSITION":T1$="":GOTO4143
4120 PRINT MID$(A$(LN),LE,1):INPUT"CORRECT CHARACTER ";CC$
4130 IF LEFT$(CC$,1)<>"Y" THEN 4100
4140 T1$=LEFT$(A$(LN),LE)
4143 T2$=MID$(A$(LN),(LE+1))
4145 T$=""
4150 PRINT T1$
4160 WAIT 0,1,1
4170 A=INP(1):A=A AND 127
4180 IF A=13 THEN 4210
4190 T$=T$+CHR$(A):PRINT CHR$(A);
4200 IF LEN(A$(LN))+LEN(T$)=69 THEN PRINT "";
4205 GOTO 4160
4210 A$(LN)=T1$+T$+T2$:PRINT T2$
4220 GOTO 300
4399 REM *** LINE INSERT SECTION
4400 INPUT"AFTER WHICH LINE ";LN
4410 PRINT A$(LN):INPUT"CORRECT LINE ";CL$
4420 IF LEFT$(CL$,1)<>"Y" THEN 4400
4430 LN=LN+1
4440 FOR L=K2 TO LN STEP -1
4450 A$(L+1)=A$(L)
4460 NEXT L:K2=K2+1
4470 PRINT"READY ":A$(LN)="":K=0
4480 WAIT 0,1,1
4490 A=INP(1):A=A AND 127
4500 IF A=13 THEN 4560
4510 IF A=95 THEN 4800
4520 IF A=64 THEN A$(LN)="":PRINT:GOTO 4480
4530 B$=CHR$(A):PRINT B$;:K=K+1
4540 A$(LN)=A$(LN)+B$
4550 GOTO 4480
4560 PRINT:GOTO 300
4800 IF K=0 THEN PRINT"":GOTO 4480
4802 IF K=1 THEN K=0:A$(LN)="":PRINT"":GOTO 4480
4803 A$(LN)=LEFT$(A$(LN),K-1):K=K-1
4810 PRINT:PRINT A$(LN);
4820 GOTO 4480
4999 REM *** DELETE SECTION
5000 INPUT"CHARACTER OR LINE ";CL$
5010 IF LEFT$(CL$,2)="CH" THEN 5100
5020 IF LEFT$(CL$,2)="LI" THEN 5400
5030 GOTO 5000
5099 REM *** CHARACTER DELETE SECTION
5100 INPUT "WHICH LINE ";LN
5110 PRINT A$(LN):INPUT "CORRECT LINE ";CL$
5120 IF LEFT$(CL$,1)<>"Y" THEN 5100
5130 INPUT "AFTER WHICH CHARACTER ";N
5140 IF N=0 THEN PRINT"DELETE STARTS WITH CHARACTER 1":GOTO 5170
5145 PRINT MID$(A$(LN),N,1)
5150 INPUT "CORRECT CHARACTER ";CC$
5160 IF LEFT$(CC$,1)<>"Y" THEN 5130
5170 INPUT"DELETE HOW MANY ";N2
5180 IF LEN(A$(LN))-N<N2 THEN 5170
5185 IF N=0 THEN T1$="":GOTO 5200
5190 T1$=LEFT$(A$(LN),N)
5200 T=LEN(A$(LN))-(N+N2)
5210 T2$=RIGHT$(A$(LN),T)
5220 T$=MID$(A$(LN),(N+1),N2)
5230 PRINTT1$;"/";T$;"/";T2$
5240 INPUT "CORRECT ";C$
5250 IF LEFT$(C$,1)<>"Y" THEN 5170
5260 A$(LN)=T1$+T2$
5270 PRINT A$(LN)
5280 GOTO 300
5399 REM *** LINE DELETE SECTION
5400 INPUT "DELETE WHICHH LINE ";WL
5410 IF WL=<0 OR WL>=K2 THEN 5400
5420 PRINT A$(WL):INPUT"CORRECT LINE ";CL$
5430 IF LEFT$(CL$,1)<>"Y" THEN 5400
5440 IF A$(WL)="END" THEN 300
5450 FOR J=WL TO K2-1
5460 A$(J)=A$(J+1)
5470 NEXT J:K2=K2-1
5480 INPUT "NEXT LINE ALSO ";NL$
5490 IF LEFT$(NL$,1)="Y" THEN 5440
5500 GOTO 300
5599 REM *** EDIT SEARCH SECTION
5600 PRINT "WHAT PHRASE ";
5605 A1$="":Y=0
5610 WAIT 0,1,1
5620 A=INP(1):A=A AND 127
5630 IF A=13 THEN PRINT:GOTO 5700
5640 IF A=64 OR A=95 THEN A1$="":GOTO 5600
5650 B$=CHR$(A):PRINT B$;:A1$=A1$+B$
5655 GOTO 5610
5700 L=LEN(A1$)
5710 FOR I=1 TO 1000
5720 IF LEN(A$(I))<L THEN 6000
5730 FOR J=1 TO LEN(A$(I))-1
5740 IF A1$=MID$(A$(I),J,L) THEN 5760
5750 GOTO 5950
5760 IF Y=0 THEN Y=1:GOTO 5770
5765 GOTO 5780
5770 PRINTCHR$(34);A1$;CHR$(34);" CAN BE FOUND ON :"
5780 PRINT "LINE";I;",POSITION";J;"."
5950 NEXT J
6000 NEXT I
6100 IF Y=0 THEN PRINTCHR$(34);A1$;CHR$(34);" IS NOT IN THE TEXT."
6110 GOTO 300
,POSITION";J;"."